// Copyright 2007-2015 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//  
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the 
// License at 
// 
//     http://www.apache.org/licenses/LICENSE-2.0 
// 
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
// CONDITIONS OF ANY KIND, either express or implied. See the License for the 
// specific language governing permissions and limitations under the License.
namespace MassTransit.AzureServiceBusTransport.Contexts
{
    using System;
    using System.Threading.Tasks;
    using Microsoft.ServiceBus;
    using Microsoft.ServiceBus.Messaging;


    public interface ConnectionContext :
        PipeContext
    {
        /// <summary>
        /// The messaging factory initialized for the service bus
        /// </summary>
        Task<MessagingFactory> MessagingFactory { get; }

        /// <summary>
        /// The messaging factory initialized for the service bus
        /// </summary>
        Task<MessagingFactory> SessionMessagingFactory { get; }

        /// <summary>
        /// The namespace manager for the service bus
        /// </summary>
        Task<NamespaceManager> NamespaceManager { get; }

        /// <summary>
        /// The namespace manager at the root of the namespace
        /// </summary>
        Task<NamespaceManager> RootNamespaceManager { get; }

        /// <summary>
        /// Return the address for the specified queue
        /// </summary>
        /// <param name="queueDescription"></param>
        /// <returns>The address of the queue</returns>
        Uri GetQueueAddress(QueueDescription queueDescription);

        /// <summary>
        /// return the path of the queue for this connection
        /// </summary>
        /// <param name="queueDescription"></param>
        /// <returns></returns>
        string GetQueuePath(QueueDescription queueDescription);

        /// <summary>
        /// Returns the Topic address for the message type being published
        /// </summary>
        /// <param name="messageType"></param>
        /// <returns></returns>
        Uri GetTopicAddress(Type messageType);
    }
}